<template>
  <div class="project-analyse">
    <router-header title="项目复盘">
    </router-header>
    <div>
      <el-form>
        <el-row :gutter="20">
            <el-col :span="6">
                <el-form-item label="项目名称：">{{
                  projectName
                }}</el-form-item>
            </el-col>
            <!-- <el-col :span="18">
                <el-form-item label="项目目标：">{{
                  }}</el-form-item>
            </el-col> -->
            <el-col :span="6">
                <el-form-item label="项目编号：">{{
                  projectCode
                  }}</el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="业务类型:">{{
                  businessType
                  }}</el-form-item>
            </el-col>
        </el-row>
      </el-form>
      <el-form label-width="112px" :inline="true">
        <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="复盘参与人：" size="mini" prop="participant">
                  <WorkflowSelect
                  v-model="ruleForm.participant"
                  class="workflow-select"
                ></WorkflowSelect>
                </el-form-item>
              </el-col>
              <el-col :span="24" style="position:relative; top:-2px">
                <el-form-item label="复盘时间： " prop="AnalyseTime" size="mini">
                    <el-date-picker
                      v-model="ruleForm.AnalyseTime"
                      type="datetime"
                      placeholder="选择时间"
                      format="yyyy-MM-dd HH:mm:ss"
                      value-format="yyyy-MM-dd HH:mm:ss"
                    ></el-date-picker>
                  </el-form-item>
              </el-col>
              <!-- <el-col :span="24" style="position:relative; top:-5px">
                <el-form-item label="复盘主题： " size="mini" prop="Analyseinput">
                  <el-input
                      class="Analyseinput"
                      v-model="ruleForm.Analyseinput"
                      placeholder="请输入内容"
                    ></el-input>
                  </el-form-item>
              </el-col> -->
          </el-row>
      </el-form>
      <div class="line"></div>
      <el-form>
        <div>
          <el-row>
              <el-col :span="24">
                <el-form-item label="项目执行情况" prop="AnalyseResults">
                  <el-input
                      type="textarea"
                      :rows="3"
                      v-model="ruleForm.AnalyseResults"
                      placeholder="实际项目执行情况如何，与目标相比哪些做的好，哪些未达到预期"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="项目出现的问题及原因及解决方法" prop="AnalysisReason">
                  <el-input
                      type="textarea"
                      :rows="3"
                      v-model="ruleForm.AnalysisReason"
                      placeholder="主观原因有哪些，成败关键因素是什么"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="项目可借鉴之处" prop="Conclusionregular">
                  <el-input
                      type="textarea"
                      :rows="3"
                      v-model="ruleForm.Conclusionregular"
                      placeholder="在过程中学到什么东西，给其他同类项目建议和意见"
                  ></el-input>
                </el-form-item>
              </el-col>
          </el-row>
        </div>
        <div>
          <el-form-item label="客户反馈表：">
            <!-- <Upload v-model="accessoryList" acceptStr=".doc,.docx,.jpg,.jpeg,.png,.pdf,.pptx"></Upload> -->
            <Upload v-model="ruleForm.accessoryList" fielState="12" :limit="10"></Upload>
            <el-button size="small" type="primary" style="position:relative; left:102px" @click="downloadTemplate">下载模板</el-button>
          </el-form-item>
          <el-form-item label="其他附件：" style="position:relative; left:14px">
            <!-- <Upload v-model="OtherAccessoryList" acceptStr=".doc,.docx,.jpg,.jpeg,.png,.pdf,.pptx"></Upload> -->
            <Upload v-model="ruleForm.OtherAccessoryList" fielState="13" :limit="10"></Upload>
          </el-form-item>
        </div>
        <div>
          <el-button type="primary" style="position:relative; left:500px" @click="handleClickSubmit">提交</el-button>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
import WorkflowSelect from '@/components/WorkflowSelect/index.vue';
// import Upload from './components/Upload.vue';
// import { SystemController } from '@/api';
import { Administration } from '@/api/projectAdministration.js';
export default {
  name: 'ProjectsAnalyseAdd',
  data () {
    return {
      accessoryList: '',
      projectId: '',
      OtherAccessoryList: '',
      projectName: '',
      participant: [], //   参与人list
      ruleForm: {
        AnalyseTime: '',
        // Analyseinput: '',
        AnalyseResults: '',
        AnalysisReason: '',
        Conclusionregular: '',
        participant: ''
      }
    }
  },
  created () {
    this.projectId = this.$route.query.projectId
    this.projectName = this.$route.query.projectName
    this.projectCode = this.$route.query.projectCode
    this.businessType = this.$route.query.businessType
  },
  components: {
    WorkflowSelect
    // Upload
  },
  methods: {
    // 下载模板
    // downloadTemplate () {
    //   var a = document.createElement('a');
    //   a.href = 'public/static/TestTemplate.xlsx';
    //   a.download = '测试下载模板.xlsx';
    //   a.style.display = 'none';
    //   document.body.appendChild(a);
    //   a.click();
    //   a.remove();
    // },
    // 下载项目复盘模板
    downloadTemplate () {
      return new Promise((resolve, reject) => {
        Administration.getAnalyseExcel(this, {}, '项目复盘模板.xlsx');
      });
    },
    // 提交项目复盘
    handleClickSubmit () {
      Administration.saveAnalyse(this, {
        projectId: this.projectId,
        projectName: this.projectName,
        analysePeopleList: this.ruleForm.participant,
        analyseDate: this.ruleForm.AnalyseTime,
        // analyseTheme: this.ruleForm.Analyseinput,
        goalResult: this.ruleForm.AnalyseResults,
        analysisReason: this.ruleForm.AnalysisReason,
        conclusionRegular: this.ruleForm.Conclusionregular,
        feedbackFile: this.ruleForm.accessoryList,
        OtherFile: this.ruleForm.OtherAccessoryList
      }).then((res) => {
        this.$message({
          message: '添加成功',
          type: 'success'
        });
        // 设置归档成功后，返回上一级路由
        this.$router.go(-1)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.project-analyse{
  // 修改elment-ui样式，在有scoped情况下，加/deep/
  /deep/.el-form-item__label{
    font-weight: bold;
    font-size: 15px;
  }
  /deep/.el-input__inner{
    width: 300px;
  }
  // /deep/.el-col.el-col.el-col-24{
  //   line-height: 10px;
  // }
.line{
  width: 100%;
  height: 2px;
  background: rgba(242, 242, 242, 1);
  margin-bottom: 15px;
}
}
</style>
